ROLLBACK PREPARED
ROLLBACK PREPARED — Cancel a transaction that was previously prepared for two-phase commit
Synopsis
ROLLBACK PREPARED transaction_id
Description
ROLLBACK PREPARED rolls back a transaction that is in the prepared state.
Parameters
transaction_id
The transaction identifier of the transaction to be rolled back.
Notes
To roll back a prepared transaction, you must be either the same user who originally executed the transaction or a superuser. However, you do not need to be in the same session where the transaction was executed.
This command cannot be executed within a transaction block. The prepared transaction is rolled back immediately.
The pg_prepared_xacts system view lists all currently available prepared transactions.
Examples
-- Roll back the transaction with transaction identifier foobar:
ROLLBACK PREPARED 'foobar';